Use a custom trace! macro in resolution
authorAlex Crichton <alex@alexcrichton.com>
Tue, 11 Aug 2015 00:09:11 +0000 (17:09 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 11 Aug 2015 00:09:11 +0000 (17:09 -0700)
Apparently not actually emitting the calls to trace! saves a good deal of stack
space, fixing the overflow found in #1875.

Closes #1875

src/cargo/core/resolver/mod.rs

index 223966a9dd9c5d9f2dac00c7c28ab29ed762d6ab..5cdfefa2a0046dec52f2e9fc4d86e166886ed99e 100644 (file)
@@ -110,6 +110,14 @@ pub use self::encode::Metadata;
 
 mod encode;
 
+macro_rules! trace {
+    ($($e:tt)*) => (
+        if cfg!(debug_assertions) {
+            debug!($($e)*);
+        }
+    )
+}
+
 /// Represents a fully resolved package dependency graph. Each node in the graph
 /// is a package and edges represent dependencies between packages.
 ///
@@ -280,7 +288,7 @@ fn activate(mut cx: Box<Context>,
         cx.visited.remove(id);
         return finished(cx, registry)
     }
-    debug!("activating {}", parent.package_id());
+    trace!("activating {}", parent.package_id());
 
     let deps = try!(cx.build_deps(registry, parent, method));